﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using pwblog.Entities;
using pwblog.BusinessObject;

namespace pwblog.Web
{
    public partial class ArticlesCategory : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LoadArticlesByCategory();
            }
        }

        /// <summary>
        /// 
        /// </summary>
        private void LoadArticlesByCategory()
        {
            string idCategory = Request.QueryString["idCategory"];
            if (idCategory != null)
            {
                Article[] articles = new ArticleBo().GetArticlesByCategory(idCategory);
                if (articles.Count() > 0)
                {
                    artiRepeater.DataSource = articles;
                    artiRepeater.DataBind();
                }
                else
                {
                    lblResult.Text = "There're not any Articles.";
                }
            }
        }
    }
}